package com.donquijote.spring.bean;

/**
 * @author 421527548@qq.com
 * @version V1.0
 * @title
 * @description
 * @date 2022-11-14 15:02
 */
 public class ProfessionFactory {
    public static Profession getStudent(){
        return new Student();
    }

    public static Profession getProfession(String type){
        if("SOLDIER".equals(type)){
            return new Soldier();
        }else if("STUDENT".equals(type)){
            return new Student();
        }else {
          throw new RuntimeException("不能创建该类");
        }
    };
}
